/* Turska UI library
 * Copyright 2003-2008 Jetro Lauha
 * All rights reserved.
 * Web: http://iki.fi/jetro/ or http://jet.ro
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of EITHER:
 *   (1) The GNU Lesser General Public License as published by the Free
 *       Software Foundation; either version 2.1 of the License, or (at
 *       your option) any later version. The text of the GNU Lesser
 *       General Public License is included with this library in the
 *       file LICENSE-LGPL.txt.
 *   (2) The BSD-style license that is included with this library in
 *       the file LICENSE-BSD.txt.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
 * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
 *
 * $Id: UIImageSDL.h,v 1.3 2008/03/27 11:44:24 tonic Exp $
 * $Revision: 1.3 $
 */

#ifndef UIIMAGESDL_H_INCLUDED
#define UIIMAGESDL_H_INCLUDED


struct SDL_Surface;

//! SDL surface implementation of the UIImage interface.
/*! \todo color support etc.
 */
class UIImageSDL : public UIImage
{
public:

    //! Constructs a new SDL surface UI image to a default state.
    /*! \param surface SDL surface to wrap.
     */
    UIImageSDL(SDL_Surface *surface, UINT32 flags);
    //! Destructor deletes the surface.
    virtual ~UIImageSDL();

    // From UIImage:

    virtual void setColor(UINT8 red, UINT8 green, UINT8 blue, UINT8 alpha = 0xff);
    virtual void setColor(FLOAT red, FLOAT green, FLOAT blue, FLOAT alpha = 1.0f);

    virtual void setTargetSize(UINT32 width, UINT32 height) { mTargetWidth = width; mTargetHeight = height; }
    virtual void setTargetSize(FLOAT width, FLOAT height) { setTargetSize((UINT32)(INT32)width, (UINT32)(INT32)height); }

    virtual void setAngle(FLOAT angle) { /* TODO mAngle = angle;*/ }

    virtual void setScale(FLOAT scale) { /* TODO mScale = scale;*/ }

    virtual void draw(INT32 x, INT32 y) { draw(mDrawMode, mFlags, x, y); }
    virtual void draw(FLOAT x, FLOAT y) { draw((INT32)x, (INT32)y); }

    virtual void draw(UINT drawMode, UINT32 flags, INT32 x, INT32 y);
    virtual void draw(UINT drawMode, UINT32 flags, FLOAT x, FLOAT y) { draw(drawMode, flags, (INT32)x, (INT32)y); }

    virtual void draw(UINT drawMode, UINT32 flags, FLOAT x, FLOAT y, FLOAT red, FLOAT green, FLOAT blue, FLOAT alpha)
    {
        // TODO: color support
        draw(drawMode, flags, (INT32)x, (INT32)y);
    }

    virtual void draw(UINT drawMode, UINT32 flags, FLOAT x, FLOAT y, const FLOAT *color)
    {
        // TODO: color support
        draw(drawMode, flags, (INT32)x, (INT32)y);
    }

    // UIImageSDL additions:

    inline SDL_Surface * getSurface() { return mSurface; }

protected:

    SDL_Surface *mSurface;
    /*
    const INT32 mNegHalfWidth;
    const INT32 mNegHalfHeight;
    const INT32 mPosHalfWidth;
    const INT32 mPosHalfHeight;
    */
    //UINT32 mColor;
    UINT32 mTargetWidth;
    UINT32 mTargetHeight;
    //FLOAT mAngle;
    //FLOAT mScale;
};


#endif // !UIIMAGESDL_H_INCLUDED
